<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>酒店信息系统</title>
<LINK rel=stylesheet href="__PUBLIC__/css/style.css">
<script>
function subsou(){
	var filmname = $("#filmname").val();
	window.location.href='__APP__/admin/showdetail?filmname='+filmname;
}
function batchs(val){
    var flag=val;

    $("#show"+flag).show();
}
function sureclick(val){
    var flag=val;
var menu= $("#menu").val();
    var hotelarr="";
    $("input[name=hotelbox]:checked").each(function(){
        hotelarr+=$(this).val()+"%";
    })
 //   alert(hotelarr);
    $.post("__APP__/admin/detail_addmovie",{
        arr : hotelarr,
        menu:menu
    }, function(data) {
        if(data.msg=="1"){

            location.reload();
        }else{

        }
    },"json");
}
function edit(val,flag){
    var json=JSON.parse(val);

    $("#id").val(json.id);
    $("#movie_name").html(json.movie_name);
    $("#movie_addr").html(json.movie_addr);
    $("#movie_pic").html(json.movie_pic);
    $("#movie_post").html(json.movie_post);
    $("#movie_trailer").html(json.movie_trailer);
 //   $("#movie_content").val(json.movie_content);

    var movieInfo=json.movie_content.split("#");

    var movie_menu =movieInfo[0];
    var movie_price =  movieInfo[1];
    var movie_info=movieInfo[2];
    var language=movieInfo[3];
    var movie_ss=movieInfo[4];

    var moviearry=movie_info.split("@");
    var details =  moviearry[0];
    var director = moviearry[1];
    var actor =moviearry[2];
    var hot = moviearry[3];
    var movie_length =moviearry[4];
    var movie_area =  moviearry[5];
    var showtime = moviearry[6];
    var label =moviearry[7];
    var score =  moviearry[8];
    var playtimes = moviearry[9];
    var resolution =moviearry[10];

    $("#details").html(details);
    $("#actor").html(actor);
    $("#director").html(director);
    $("#movie_price").html(movie_price);
    $("#hot").html(hot);
    $("#movie_length").html(movie_length);
    $("#movie_area").html(movie_area);
    $("#showtime").html(showtime);
    $("#label").html(label);
    $("#score").html(score);
    $("#playtimes").html(playtimes);
    $("#resolution").html(resolution);
    $("#movie_menu").html(movie_menu);
    $("#language").html(language);
    $("#movie_ss").html(movie_ss);
    $("#show").show();
}


function quxiao0(){
	$("#show0").hide();
}

function checkallstu(o) {
    if(o.checked){
        $("input[name='moviebox']").attr("checked",true);
    }else{
        $("input[name='moviebox']").attr("checked",false);
    }
}
function delall(){
    var arr="";
    $("input[name=moviebox]:checked").each(function(){
        arr+=$(this).val()+",";
    })
    if(arr==""){
        alert('请选择要删除的记录');
        return false;
    }
    if (!confirm("您确定要删除吗？")){
        return false;
    }
    var filemenu='{$filmnemu}';
    $.post("__APP__/admin/detail_delmovie",{
        arr : arr,
        menu:filemenu
    }, function(data) {
        if(data.msg=="1"){
            alert("删除成功");
            location.reload();
        }else if(data.msg=="3"){
            alert( data.info);
            location.reload();
        }else{
            alert("删除失败");
        }
    },"json");
}

    function editmovie(){
        var name= $("#movie_name").html();
        window.location.href='__APP__/admin/dygl?filmname='+name
      //  alert(name);
    }

function addmovie(){
        var filemenu='{$filmnemu}';
        $.post("__APP__/admin/catmovie",{

        }, function(data) {
            if(data.msg=="1"){
                var json=data.moviesArr;
                var tempData = "";
                var length=json.length;
                var i=1;
                for (var data in json){
                    var json_data=JSON.stringify(json[data]);
                    var movieInfo=json[data].movie_content.split("#");
                    var movie_menu =movieInfo[0];
                    var r=movie_menu.indexOf(filemenu);
                    var checked = '';
                    if(r >=0){
                        checked='checked';
                    }
                    if((i%4)==1){

                        //    alert(json_data);

                        tempData  =  tempData + " <tr class='ctt_white'><td width='31' align='right'><input  type='checkbox' name='hotelbox' id='hotelbox'  value='"+json[data].id+"++"+json[data].movie_content+"++"+json[data].movie_name+"'"+checked+"><\/td><td  width='81' align='left'>"+json[data].movie_name+"<\/td>";

                    }else if(!(i%4)){
                        tempData  =  tempData + " <td  width='31' align='right'><input  type='checkbox' name='hotelbox' id='hotelbox'  value='"+json[data].id+"++"+json[data].movie_content+"++"+json[data].movie_name+"'"+checked+"><\/td><td  width='81' align='left' >"+json[data].movie_name+"<\/td><\/tr>";

                    }else{
                        tempData  =  tempData + " <td  width='31' align='right'><input  type='checkbox' name='hotelbox' id='hotelbox'  value='"+json[data].id+"++"+json[data].movie_content+"++"+json[data].movie_name+"'"+checked+"><\/td><td  width='81' align='left' >"+json[data].movie_name+"<\/td>";

                    }
                    i++;
                }
                if(length%4){
                    var l=(4-length%4)*2;
                    tempData  =  tempData +"<td colspan='"+l+"'></td><\/tr>";
                }
                $("#showmovie").show();
                $("#movie_s").html(tempData);
                $("#menu").val(filemenu);
            }else{

            }
        },"json");
    }
</script>
</head>
<body>
{include file="public/head"} 

</div>
<div class="content_2 clear">
{include file="admin/left"}
 <div class="content_3 left">
  <div class="content_3_wz"><img src="__PUBLIC__/images/dajt.png">系统管理 > 影库管理</div>
  <div class="content_3_fdj"><img src="__PUBLIC__/images/fdj.jpg"></div>
  <div class="content_3_xian"></div>
     <div class="content_3_ss clear">
         <ul>
             <li><span class="ctt_wd left">电影名：</span>
                 <input name="text" type="text" class="layui-input" id="filmname"size="8"/>
             </li>

             <li class="ss_cx"><a href="#"  onClick="subsou()">查询</a></li>
             <!--<li class="ss_cx"><a href="__APP__/system/movieimport">导入</a></li>-->
         </ul>

     </div>

       <table class="layui-table" lay-skin="line" >
        <thead >
         <tr>
             <td width="51" >选择</td>
             <td width="110">电影名</td>
             <td width="87" >价格</td>
             <td width="87" >排序</td>

             <td width="49" >操作</td>

         </tr>
         </thead>
         <tbody>
         <?
      if($moviesArr){
      	foreach($moviesArr as $val){
      	 $tmp = addslashes(json_encode($val));
     	 $stime=date("Y-m-d H:i:s",$val['stime']);

         $moviearry=explode('#',$val[movie_content]);
     	 $price=$moviearry[1];
     	 $movieContentarry=explode('@',$moviearry[2]);

        $morder = $movieContentarry[11];
        $morder=$morder?$morder:0;

   ?>
         <tr class="ctt_white">
             <td><input  type="checkbox" name="moviebox" id="moviebox"  value="{$val[id]}"></td>
             <td>{$val[movie_name]}</td>
             <td>{$price}</td>
             <td>{$morder}</td>

             <td> <a href="#" class="layui-btn layui-btn-sm" onclick='edit("{$tmp}",2)'>查看 </a></td>
         </tr>
         <?php
		 }
	  }?>
         </tbody>
     </table>

     <div class="content_1234">
         <div class="content_glcz">管理操作：全选
             <input name="checkbox" type="checkbox" onClick="checkallstu(this)" />
             <input name="submit" type="submit" value="删除" onclick="delall()" class="layui-btn layui-btn-sm layui-btn-warm"/>
             <input name="submit2" type="submit" value="添加" onclick='addmovie()'  class="layui-btn layui-btn-sm"/>
         </div>
         <div class="layui-box layui-laypage layui-laypage-default">{$page}</div>
     </div>


     <div id="show" style="DISPLAY:none" class="show" >
         <table class="layui-table" lay-skin="line">
            <thead >
             <tr>
                 <td colspan="4">电影信息</td>
                 <input type="hidden" id="id" name="id">

             </tr>
             </thead>
             <tbody>
             <tr class="ctt_gr">
                 <td width="144" align="right">电影名：</td>
                 <td align="left" id="movie_name" name="movie_name" >

                 </td>
                 <td  align="right">搜索关键字：</td>
                 <td align="left"  id="movie_ss" name="movie_ss">

                 </td>

             </tr>
             <tr class="ctt_gr">
                 <td width="144"  align="right">电影路径：</td>
                 <td width="348" align="left" colspan="3" id="movie_addr" name="movie_addr">

                 </td>

             </tr>
             <tr class="ctt_gr">
                 <td  align="right">片花路径：</td>
                 <td align="left" colspan="3" id="movie_trailer" name="movie_trailer">

                 </td>

             </tr>

             <tr class="ctt_gr">
                 <td  align="right">电影缩略图：</td>
                 <td  align="left" colspan="3" id="movie_pic" name="movie_pic">

                 </td>

             </tr>

             <tr class="ctt_gr">
                 <td  align="right">电影海报：</td>
                 <td  align="left" colspan="3" id="movie_post" name="movie_post">

                 </td>

             </tr>
             <tr class="ctt_gr">
                 <td  align="right">价格：</td>
                 <td align="left" colspan="3" id="movie_price" name="movie_price">

                 </td>

             </tr>

             <tr class="ctt_gr">
                 <td  align="right">导演：</td>
                 <td  align="left" colspan="3" id="director" name="director">

                 </td>

             </tr>

             <tr class="ctt_gr">
                 <td  align="right" >主演：</td>
                 <td  align="left" colspan="3" id="actor" name="actor">

                 </td>

             </tr>
             <tr class="ctt_gr">
                 <td  align="right">电影简介：</td>
                 <td  align="left" colspan="3"  id="details" name="details">

                 </td>
             </tr>
             <tr class="ctt_gr">
                 <td  align="right">上映时间：</td>
                 <td  align="left" colspan="3" id="showtime" name="showtime">

                 </td>

             </tr>

             <tr class="ctt_gr">
                 <td  align="right">类型标签：</td>
                 <td  align="left" colspan="3" id="label" name="label">

                 </td>

             </tr>
             <tr class="ctt_gr">
                 <td  align="right" width="80">热度：</td>
                 <td  align="left"  id="hot" name="hot">

                 </td>
                 <td  align="right" width="80">片源分辨率：</td>
                 <td  align="left" id="resolution" name="resolution">

                 </td>
             </tr>

             <tr class="ctt_gr">
                 <td  align="right" width="70">时长：</td>
                 <td  align="left" id="movie_length" name="movie_length">

                 </td>
                 <td  align="right" width="70">地区：</td>
                 <td  align="left" id="movie_area" name="movie_area">

                 </td>
             </tr>


             <tr class="ctt_gr">
                 <td  align="right" width="80">评分：</td>
                 <td  align="left" width="80" id="score" name="score">

                 </td>
                 <td  align="right">播放次数：</td>
                 <td  align="left" id="playtimes" name="playtimes">

                 </td>

             </tr>


             <tr class="ctt_gr">
                 <td  align="right">分类目录：</td>
                 <td  align="left" colspan="3" id="movie_menu" name="movie_menu">

                 </td>

             </tr>

             <tr class="ctt_gr">
                 <td height="31" colspan="4" align="center"><input name="submit22" type="button" value="修改" border="0" onclick="editmovie()" class="layui-btn"/>
                     <input name="submit22" type="button" value="关闭" border="0" onclick="document.getElementById
	('show').style.display='none'" class="layui-btn layui-btn-warm"/></td>
             </tr>
             </tbody>
         </table>

     </div>


  <div id="showmovie" style="DISPLAY:none" class="show">
      <table width="700" border="0" align="center"  cellpadding="0" bgcolor="#FFFFFF" style="text-align:center; border:1px solid #e4e4e4;">
         <thead >
          <tr>
              <td colspan="8">电影列表</td>
              <input type="hidden" id="menu" name="menu">
              <
          </tr>
          <tr>
              <td class="ctt_white" colspan="8" align="center">电影名：<input  type="text" name="movie_sou" id="hotel_sou" >
                  <input name="button" type="button"  onclick="sou_movie()"  value="查询" border="0" />
              </td>
          </tr>
          </thead>
          <tbody id="movie_s">

          </tbody>
          <tfoot>
          <tr class='ctt_white'>
              <td height="31" colspan="8" align="center"><input name="button" type="button"  onclick="sureclick('movie')"  value="确定" border="0"  class="layui-btn"/>
                  <input name="submit22" type="button" value="关闭" border="0" onclick="document.getElementById
	('showmovie').style.display='none'" class="layui-btn layui-btn-warm"/></td>
          </tr>
          </tfoot>
      </table>
  </div>


 </div>
</div>
</body>
</html>

